//
//  LeadSecondCollectionViewCell.m
//  
//
//  Created by dllo on 15/10/19.
//
//

#import "LeadSecondCollectionViewCell.h"

@interface LeadSecondCollectionViewCell ()

@property (nonatomic, retain) UIImageView *imageV;

@property (nonatomic, retain) UILabel *numL;

@property (nonatomic, retain) UIButton *button;

@end

@implementation LeadSecondCollectionViewCell



- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    [self.contentView addSubview:self.imageV];
    
    
    self.numL = [[UILabel alloc] initWithFrame:CGRectMake(150 * WIDTH, 3 * HEIGHT, 150 * WIDTH, 150 * HEIGHT)];
    //    self.numL.backgroundColor = [UIColor redColor];
    self.numL.textAlignment = NSTextAlignmentCenter;
    self.numL.font = [UIFont systemFontOfSize:100 * WIDTH];
    [self.contentView addSubview:self.numL];
    
    
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button.frame = CGRectMake(0, 617 * HEIGHT, 400 * WIDTH, 50 * HEIGHT);
//    self.button.font = [UIFont systemFontOfSize:20];
    [self.button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    self.button.backgroundColor = [UIColor redColor];
    [self.button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.button];
    
    
    
}

- (void)setValue
{
    //self.imageV.image = [UIImage imageNamed:@"leadImage5.jpeg"];
    self.numL.text = @"1";
    [self.button setTitle:@"世界很美, 而你正好有空>>>" forState:UIControlStateNormal];
}

- (void)buttonAction
{
    NSUserDefaults *visit = [NSUserDefaults standardUserDefaults];
    [visit setObject:@"yes" forKey:@"firstvisit"];
    
    [visit synchronize];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"lead" object:nil];
    
}



@end
